package com.rpj.stauy.controller;

import com.rpj.stauy.service.MemoryChatAssistant;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
@Slf4j
public class MemoryController {


    @Resource(name = "memory")
    private MemoryChatAssistant memoryChatAssistant;
    @Resource(name = "memoryAndStream")
    private MemoryChatAssistant memoryAndStream;

    //http://localhost:9096/memory/chat
    @GetMapping("memory/chat")
    public String memoryChat() {
        memoryChatAssistant.chat(1L, "我叫JAVA");
        return memoryChatAssistant.chat(1L,"我叫什么");
    }

    //http://localhost:9096/memory/flux
    @GetMapping("memory/flux")
    public Flux<String> memoryChatFlux() {
        memoryAndStream.chatFlux(1L, "我叫JAVA");
        return memoryAndStream.chatFlux(1L,"我叫什么");
    }

}
